package jrain.fw.core.business;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

 
/**
 * <pre>
 * 作者：3244924214@qq.com 
 * 描述： 业务响应
 * </pre>
 */
public class BusinessResponse implements Serializable {

	private static final long serialVersionUID = 1L;
	/**
	 * 响应编码
	 */
	private int code = BusinessConst.RES_CODE_SUCCESS;
	/**
	 * 响应消息
	 */
	private String msg;

	/**
	 * 错误详情
	 */
	private String dtl;
	/**
	 * 响应数据总数
	 */
	private int total;
	/**
	 * 响应数据内容
	 */
	private Object data = "";

	/**
	 * 扩展数据
	 */
	private Map<String, Object> extData = new HashMap<String, Object>();

	public BusinessResponse() {
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getDtl() {
		return dtl;
	}

	public void setDtl(String dtl) {
		this.dtl = dtl;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public void setCodeAndMsg(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	// 扩展 -------------------------------------------------------------
	public void setExtData(Map<String, Object> extData) {
		this.extData = extData;
	}

	public void putExtData(String key, Object value) {
		extData.put(key, value);
	}

	public Map<String, Object> getExtData() {
		return extData;
	}

	public Object getExtData(String key) {
		return extData.get(key);
	}

	public void clearExtData() {
		extData.clear();
	}

}
